import 'package:riverpod_t/config/response_model.dart';
import 'package:riverpod_t/net/http_config.dart';
import 'package:riverpod_t/net/net_https.dart';
import 'package:riverpod_t/page/car/data/repository/car_api.dart';

class CarRepository {
  /// 获取汽车咨询列表
  static Future<ResponseModel> getInfoListData<T>(int pageNum) async {
    Map<String, dynamic> params = {"pn": pageNum, "ps": 20, "q": "车讯原创", "t": 0};
    ResponseModel responseModel = await NetHttp().request<T>(
      CarApi.searchURL,
      params: params,
      method: HttpConfig.get,
    );
    return responseModel;
  }

  /// 获取汽车咨询详情
  static Future<ResponseModel> getDetailInfoData<T>(int entityId) async {
    Map<String, dynamic> params = {"entityId": entityId};
    ResponseModel responseModel = await NetHttp().request<T>(
      CarApi.infoURL,
      params: params,
      method: HttpConfig.get,
    );
    return responseModel;
  }
}
